<?php

namespace Trawind\Tenancy\Traits;

trait TenantTool
{

    public function runTenantOrCentral($func)
    {
        if (!is_null($tenant = config('tenancy.tenant_model')::query()->first())) {
            return $tenant->run($func);
        }
        return $func();
    }
}